package org.insist.best.codeGenerator.dao;

import cn.hutool.core.util.StrUtil;
import org.insist.best.codeGenerator.vo.ColumnListItem;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Optional;

public class ColumnListItemMapper {
    public ColumnListItem mapRow(ResultSet rs) throws SQLException {
        ColumnListItem listItem = new ColumnListItem();
        listItem.setColumnName(rs.getString("columnName"));
        listItem.setColumnComment(rs.getString("columnComment"));
        listItem.setDateType(rs.getString("dataType"));
        listItem.setColumnKey(Optional.ofNullable(rs.getString("columnKey")).orElse(StrUtil.EMPTY));
        listItem.setExtra(Optional.ofNullable(rs.getString("extra")).orElse(StrUtil.EMPTY));
        return listItem;
    }
}
